import cv2
import matplotlib.pyplot as plt
import numpy as np


def show(img):
    cv2.imshow("img", img)
    cv2.waitKey(0)
    cv2.destroyAllWindows()


# 开：先腐蚀 再膨胀
img = cv2.imread("./01_Picture/05_Dige.png")
kernel = np.ones((5, 5), np.uint8)
opening = cv2.morphologyEx(img, cv2.MORPH_OPEN,kernel)
show(opening)

# 闭：先膨胀 再腐蚀
img = cv2.imread("./01_Picture/05_Dige.png")
kernel = np.ones((5, 5), np.uint8)
closing = cv2.morphologyEx(img, cv2.MORPH_CLOSE,kernel)
show(closing)









